home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_065 / prep / prep.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  4KB  |  122 lines

  1. #include "stdio.h"
  2. #include "string.h"
  3.  
  4. /* define C compiler here */
  5. #define CRAY            0    /* Cray C 1.0 under CTSS */
  6. #define SVS            0    /* Silicon Valley C */
  7.  
  8.  
  9. #define BLANK            ' '
  10. #define TAB            '\t'
  11. #define TRUE            1
  12. #define FALSE            0
  13. #define    NOT            !
  14. #define    DEF_UNROLL_DEPTH    8
  15. #define    DEF_LINE_LIMIT        1
  16. #define DEF_BUFFSIZE        200
  17. #define    STORE_SIZE        1000
  18. #define    NESTING            10
  19. #define    MAX_TOKENS        2*NESTING    /* tokens and macro args */
  20. #define exp            expression    /* used exp as a variable */
  21.  
  22. #define min(x,y) ((x) < (y) ? (x) : (y))
  23. #define max(x,y) ((x) > (y) ? (x) : (y))
  24.  
  25. #define    IN_BUFF_DONE        in_buff[0] = NULL ;
  26.  
  27. #define    UNROLLING        ( ( unroll_depth >  1          ) && \
  28.                   ( mem_count    <= line_limit ) && \
  29.                   ( var_count    >  1          ) )
  30.  
  31. #define    GET_MEM(S,A)\
  32. if ( NULL == (S = malloc(A+1)) ) {\
  33.     abort( "Memory allocation failed") ; }
  34.  
  35. #define MATCH(S)    ( strncmp( combuff, S, (name_length=strlen(S)) ) == 0 )
  36.  
  37. #define put_string(s)    fputs( s, out ) ; putc( '\n', out ) ;
  38.  
  39.  
  40. /* enumeration of command types */
  41. enum Command {
  42. type_begin, type_again, type_while, type_until,    type_leave, type_continue,
  43. type_case, type_of, type_default, type_end_case, type_continue_case,
  44. type_do_limits, type_osqb, type_csqb, type_vec, type_unroll,
  45. type_do, type_end_do, type_leave_do, type_continue_do,
  46. type_include,
  47. type_ifdef, type_ifndef, type_else, type_endif,
  48. normal, unknown
  49. } ;
  50.  
  51.  
  52. #if CRAY
  53.  
  54. /* the cray considers characters to be unsigned */
  55. #undef    EOF
  56. #define EOF    255
  57.  
  58. /* a few macros to adapt to cray namelength limitations */
  59. #define continue_proc        cont_proc
  60. #define continue_do_proc    cont_do_proc
  61. #define leave_do_proc        le_do_proc
  62. #define include_proc        inc_proc
  63.  
  64. #endif
  65.  
  66.  
  67. #if SVS
  68. #define fopen    fopena        /* cr-lf and ^Z conversion */
  69. #endif
  70.  
  71. /* function type declarations */
  72. char        *mat_del(), *line_end(), *get_rec(), get_a_char(),
  73.         *malloc(), *calloc(), *realloc(), *strtokp(),
  74.         *mac_proc(), *strupr(), *strtok(), *strchrq() ;
  75.  
  76.  
  77.  
  78. #ifdef    MAIN
  79. /*    Included stuff for main routine of program PREP  */
  80.  
  81. /* global pointers & storage */
  82. char    *in_buff, *out_buff ;        /* text buffer pointers */
  83. char    *first_nonblank ;        /* first nb char in in_buff */
  84. char    *mem_store[STORE_SIZE] ;    /* pointers to malloc areas */
  85. char    errline[2*DEF_BUFFSIZE] ;    /* error message line */
  86. char    dataf[DEF_BUFFSIZE] ;        /* data file name */
  87.  
  88. long    allocation ;          /* current size of in_buff */
  89. int    tab_size = 7 ;        /* size of the tab in blanks */
  90. int    unroll_depth = 0 ;    /* do loop unroll depth, 0 for no unrolling */
  91. int    line_limit = 1000 ;   /* unroll loops if # lines <= line_limit */
  92. int    mem_count = 0 ;       /* mem_store external counter */
  93. int    include_count = 0 ;   /* index of filestack (for includes) */
  94. int    name_length = 0 ;     /* current command name length */
  95. int    vec_flag = FALSE ;    /* TRUE if in vector loop */
  96. int    com_keep = FALSE ;    /* TRUE to keep comments */
  97. int    underline_keep=FALSE; /* TRUE to keep underline characters */
  98. int    macro_only = FALSE ;  /* TRUE to do only macro expansion */
  99. int    ignore_flag = FALSE ;  /* conditional compilation flag */
  100.  
  101. FILE    *in, *out, *filestack[NESTING] ;
  102.  
  103.  
  104.  
  105. #else
  106.  
  107. /* Header stuff for the functions of program PREP */
  108.  
  109. /* global pointers & storage */
  110. extern char    *in_buff, *out_buff, *mem_store[],
  111.         *first_nonblank, dataf[], errline[] ;
  112.  
  113. extern int    tab_size, unroll_depth, line_limit, com_keep, vec_flag,
  114.         mem_count, underline_keep, include_count, macro_only,
  115.         name_length, ignore_flag ;
  116.  
  117. extern long    allocation ;
  118.  
  119. extern    FILE    *in, *out, *filestack[] ;
  120.  
  121. #endif
  122.